.class public Lorg/microemu/util/RecordStoreImpl;
.super Ljavax/microedition/rms/RecordStore;
.source "RecordStoreImpl.java"


# instance fields
.field private lastModified:J

.field private nextRecordID:I

.field private transient open:Z

.field private transient recordListeners:Ljava/util/Vector;

.field private transient recordStoreManager:Lorg/microemu/RecordStoreManager;

.field private recordStoreName:Ljava/lang/String;

.field protected records:Ljava/util/Hashtable;

.field private version:I


# direct methods
.method public constructor <init>(Lorg/microemu/RecordStoreManager;Ljava/io/DataInputStream;)V
    .locals 4
    .parameter "recordStoreManager"
    .parameter "dis"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    const/4 v3, 0x0

    .line 79
    invoke-direct {p0}, Ljavax/microedition/rms/RecordStore;-><init>()V

    .line 51
    new-instance v2, Ljava/util/Hashtable;

    invoke-direct {v2}, Ljava/util/Hashtable;-><init>()V

    iput-object v2, p0, Lorg/microemu/util/RecordStoreImpl;->records:Ljava/util/Hashtable;

    .line 54
    iput v3, p0, Lorg/microemu/util/RecordStoreImpl;->version:I

    .line 55
    const-wide/16 v2, 0x0

    iput-wide v2, p0, Lorg/microemu/util/RecordStoreImpl;->lastModified:J

    .line 56
    const/4 v2, 0x1

    iput v2, p0, Lorg/microemu/util/RecordStoreImpl;->nextRecordID:I

    .line 62
    new-instance v2, Ljava/util/Vector;

    invoke-direct {v2}, Ljava/util/Vector;-><init>()V

    iput-object v2, p0, Lorg/microemu/util/RecordStoreImpl;->recordListeners:Ljava/util/Vector;

    .line 80
    iput-object p1, p0, Lorg/microemu/util/RecordStoreImpl;->recordStoreManager:Lorg/microemu/RecordStoreManager;

    .line 82
    invoke-virtual {p2}, Ljava/io/DataInputStream;->readUTF()Ljava/lang/String;

    move-result-object v2

    iput-object v2, p0, Lorg/microemu/util/RecordStoreImpl;->recordStoreName:Ljava/lang/String;

    .line 83
    invoke-virtual {p2}, Ljava/io/DataInputStream;->readInt()I

    move-result v2

    iput v2, p0, Lorg/microemu/util/RecordStoreImpl;->version:I

    .line 84
    invoke-virtual {p2}, Ljava/io/DataInputStream;->readLong()J

    move-result-wide v2

    iput-wide v2, p0, Lorg/microemu/util/RecordStoreImpl;->lastModified:J

    .line 85
    invoke-virtual {p2}, Ljava/io/DataInputStream;->readInt()I

    move-result v2

    iput v2, p0, Lorg/microemu/util/RecordStoreImpl;->nextRecordID:I

    .line 89
    :goto_0
    :try_start_0
    invoke-virtual {p2}, Ljava/io/DataInputStream;->readInt()I

    move-result v1

    .line 90
    .local v1, recordId:I
    invoke-virtual {p2}, Ljava/io/DataInputStream;->readInt()I

    move-result v2

    new-array v0, v2, [B

    .line 91
    .local v0, data:[B
    const/4 v2, 0x0

    array-length v3, v0

    invoke-virtual {p2, v0, v2, v3}, Ljava/io/DataInputStream;->read([BII)I

    .line 92
    iget-object v2, p0, Lorg/microemu/util/RecordStoreImpl;->records:Ljava/util/Hashtable;

    new-instance v3, Ljava/lang/Integer;

    invoke-direct {v3, v1}, Ljava/lang/Integer;-><init>(I)V

    invoke-virtual {v2, v3, v0}, Ljava/util/Hashtable;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    :try_end_0
    .catch Ljava/io/EOFException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 94
    .end local v1           #recordId:I
    .end local v0           #data:[B
    :catch_0
    move-exception v2

    .line 96
    return-void
.end method

.method public constructor <init>(Lorg/microemu/RecordStoreManager;Ljava/lang/String;)V
    .locals 4
    .parameter "recordStoreManager"
    .parameter "recordStoreName"

    .prologue
    const/16 v3, 0x20

    const/4 v2, 0x0

    .line 66
    invoke-direct {p0}, Ljavax/microedition/rms/RecordStore;-><init>()V

    .line 51
    new-instance v0, Ljava/util/Hashtable;

    invoke-direct {v0}, Ljava/util/Hashtable;-><init>()V

    iput-object v0, p0, Lorg/microemu/util/RecordStoreImpl;->records:Ljava/util/Hashtable;

    .line 54
    iput v2, p0, Lorg/microemu/util/RecordStoreImpl;->version:I

    .line 55
    const-wide/16 v0, 0x0

    iput-wide v0, p0, Lorg/microemu/util/RecordStoreImpl;->lastModified:J

    .line 56
    const/4 v0, 0x1

    iput v0, p0, Lorg/microemu/util/RecordStoreImpl;->nextRecordID:I

    .line 62
    new-instance v0, Ljava/util/Vector;

    invoke-direct {v0}, Ljava/util/Vector;-><init>()V

    iput-object v0, p0, Lorg/microemu/util/RecordStoreImpl;->recordListeners:Ljava/util/Vector;

    .line 67
    iput-object p1, p0, Lorg/microemu/util/RecordStoreImpl;->recordStoreManager:Lorg/microemu/RecordStoreManager;

    .line 68
    invoke-virtual {p2}, Ljava/lang/String;->length()I

    move-result v0

    if-gt v0, v3, :cond_0

    .line 69
    iput-object p2, p0, Lorg/microemu/util/RecordStoreImpl;->recordStoreName:Ljava/lang/String;

    .line 73
    :goto_0
    iput-boolean v2, p0, Lorg/microemu/util/RecordStoreImpl;->open:Z

    .line 74
    return-void

    .line 71
    :cond_0
    invoke-virtual {p2, v2, v3}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object v0

    iput-object v0, p0, Lorg/microemu/util/RecordStoreImpl;->recordStoreName:Ljava/lang/String;

    goto :goto_0
.end method

.method private fireRecordListener(II)V
    .locals 9
    .parameter "type"
    .parameter "recordId"

    .prologue
    .line 411
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v3

    .line 413
    .local v3, timestamp:J
    iget-object v1, p0, Lorg/microemu/util/RecordStoreImpl;->recordListeners:Ljava/util/Vector;

    if-eqz v1, :cond_1

    .line 414
    iget-object v1, p0, Lorg/microemu/util/RecordStoreImpl;->recordListeners:Ljava/util/Vector;

    invoke-virtual {v1}, Ljava/util/Vector;->elements()Ljava/util/Enumeration;

    move-result-object v7

    .local v7, e:Ljava/util/Enumeration;
    :goto_0
    invoke-interface {v7}, Ljava/util/Enumeration;->hasMoreElements()Z

    move-result v1

    if-eqz v1, :cond_1

    .line 415
    invoke-interface {v7}, Ljava/util/Enumeration;->nextElement()Ljava/lang/Object;

    move-result-object v8

    check-cast v8, Ljavax/microedition/rms/RecordListener;

    .line 416
    .local v8, l:Ljavax/microedition/rms/RecordListener;
    instance-of v1, v8, Lorg/microemu/util/ExtendedRecordListener;

    if-eqz v1, :cond_0

    .line 417
    move-object v0, v8

    check-cast v0, Lorg/microemu/util/ExtendedRecordListener;

    move-object v1, v0

    move v2, p1

    move-object v5, p0

    move v6, p2

    invoke-interface/range {v1 .. v6}, Lorg/microemu/util/ExtendedRecordListener;->recordEvent(IJLjavax/microedition/rms/RecordStore;I)V

    goto :goto_0

    .line 419
    :cond_0
    packed-switch p1, :pswitch_data_0

    :pswitch_0
    goto :goto_0

    .line 421
    :pswitch_1
    invoke-interface {v8, p0, p2}, Ljavax/microedition/rms/RecordListener;->recordAdded(Ljavax/microedition/rms/RecordStore;I)V

    goto :goto_0

    .line 424
    :pswitch_2
    invoke-interface {v8, p0, p2}, Ljavax/microedition/rms/RecordListener;->recordChanged(Ljavax/microedition/rms/RecordStore;I)V

    goto :goto_0

    .line 427
    :pswitch_3
    invoke-interface {v8, p0, p2}, Ljavax/microedition/rms/RecordListener;->recordDeleted(Ljavax/microedition/rms/RecordStore;I)V

    goto :goto_0

    .line 432
    .end local v7           #e:Ljava/util/Enumeration;
    .end local v8           #l:Ljavax/microedition/rms/RecordListener;
    :cond_1
    return-void

    .line 419
    :pswitch_data_0
    .packed-switch 0x1
        :pswitch_1
        :pswitch_0
        :pswitch_2
        :pswitch_3
    .end packed-switch
.end method


# virtual methods
.method public addRecord([BII)I
    .locals 5
    .parameter "data"
    .parameter "offset"
    .parameter "numBytes"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljavax/microedition/rms/RecordStoreNotOpenException;,
            Ljavax/microedition/rms/RecordStoreException;,
            Ljavax/microedition/rms/RecordStoreFullException;
        }
    .end annotation

    .prologue
    .line 253
    iget-boolean v2, p0, Lorg/microemu/util/RecordStoreImpl;->open:Z

    if-nez v2, :cond_0

    .line 254
    new-instance v2, Ljavax/microedition/rms/RecordStoreNotOpenException;

    invoke-direct {v2}, Ljavax/microedition/rms/RecordStoreNotOpenException;-><init>()V

    throw v2

    .line 256
    :cond_0
    if-nez p1, :cond_1

    if-lez p3, :cond_1

    .line 257
    new-instance v2, Ljava/lang/NullPointerException;

    invoke-direct {v2}, Ljava/lang/NullPointerException;-><init>()V

    throw v2

    .line 259
    :cond_1
    iget-object v2, p0, Lorg/microemu/util/RecordStoreImpl;->recordStoreManager:Lorg/microemu/RecordStoreManager;

    invoke-interface {v2, p0}, Lorg/microemu/RecordStoreManager;->getSizeAvailable(Lorg/microemu/util/RecordStoreImpl;)I

    move-result v2

    if-le p3, v2, :cond_2

    .line 260
    new-instance v2, Ljavax/microedition/rms/RecordStoreFullException;

    invoke-direct {v2}, Ljavax/microedition/rms/RecordStoreFullException;-><init>()V

    throw v2

    .line 263
    :cond_2
    new-array v1, p3, [B

    .line 264
    .local v1, recordData:[B
    if-eqz p1, :cond_3

    .line 265
    const/4 v2, 0x0

    invoke-static {p1, p2, v1, v2, p3}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V

    .line 269
    :cond_3
    monitor-enter p0

    .line 270
    :try_start_0
    iget-object v2, p0, Lorg/microemu/util/RecordStoreImpl;->records:Ljava/util/Hashtable;

    new-instance v3, Ljava/lang/Integer;

    iget v4, p0, Lorg/microemu/util/RecordStoreImpl;->nextRecordID:I

    invoke-direct {v3, v4}, Ljava/lang/Integer;-><init>(I)V

    invoke-virtual {v2, v3, v1}, Ljava/util/Hashtable;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 271
    iget v2, p0, Lorg/microemu/util/RecordStoreImpl;->version:I

    add-int/lit8 v2, v2, 0x1

    iput v2, p0, Lorg/microemu/util/RecordStoreImpl;->version:I

    .line 272
    iget v0, p0, Lorg/microemu/util/RecordStoreImpl;->nextRecordID:I

    .line 273
    .local v0, curRecordID:I
    iget v2, p0, Lorg/microemu/util/RecordStoreImpl;->nextRecordID:I

    add-int/lit8 v2, v2, 0x1

    iput v2, p0, Lorg/microemu/util/RecordStoreImpl;->nextRecordID:I

    .line 274
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v2

    iput-wide v2, p0, Lorg/microemu/util/RecordStoreImpl;->lastModified:J

    .line 275
    monitor-exit p0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 277
    iget-object v2, p0, Lorg/microemu/util/RecordStoreImpl;->recordStoreManager:Lorg/microemu/RecordStoreManager;

    invoke-interface {v2, p0}, Lorg/microemu/RecordStoreManager;->saveChanges(Lorg/microemu/util/RecordStoreImpl;)V

    .line 279
    const/4 v2, 0x1

    invoke-direct {p0, v2, v0}, Lorg/microemu/util/RecordStoreImpl;->fireRecordListener(II)V

    .line 281
    return v0

    .line 275
    .end local v0           #curRecordID:I
    :catchall_0
    move-exception v2

    :try_start_1
    monitor-exit p0
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    throw v2
.end method

.method public addRecordListener(Ljavax/microedition/rms/RecordListener;)V
    .locals 1
    .parameter "listener"

    .prologue
    .line 225
    iget-object v0, p0, Lorg/microemu/util/RecordStoreImpl;->recordListeners:Ljava/util/Vector;

    invoke-virtual {v0, p1}, Ljava/util/Vector;->contains(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_0

    .line 226
    iget-object v0, p0, Lorg/microemu/util/RecordStoreImpl;->recordListeners:Ljava/util/Vector;

    invoke-virtual {v0, p1}, Ljava/util/Vector;->addElement(Ljava/lang/Object;)V

    .line 228
    :cond_0
    return-void
.end method

.method public closeRecordStore()V
    .locals 3
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljavax/microedition/rms/RecordStoreNotOpenException;,
            Ljavax/microedition/rms/RecordStoreException;
        }
    .end annotation

    .prologue
    .line 133
    iget-boolean v0, p0, Lorg/microemu/util/RecordStoreImpl;->open:Z

    if-nez v0, :cond_0

    .line 134
    new-instance v0, Ljavax/microedition/rms/RecordStoreNotOpenException;

    invoke-direct {v0}, Ljavax/microedition/rms/RecordStoreNotOpenException;-><init>()V

    throw v0

    .line 137
    :cond_0
    iget-object v0, p0, Lorg/microemu/util/RecordStoreImpl;->recordListeners:Ljava/util/Vector;

    if-eqz v0, :cond_1

    .line 138
    iget-object v0, p0, Lorg/microemu/util/RecordStoreImpl;->recordListeners:Ljava/util/Vector;

    invoke-virtual {v0}, Ljava/util/Vector;->removeAllElements()V

    .line 140
    :cond_1
    iget-object v0, p0, Lorg/microemu/util/RecordStoreImpl;->recordStoreManager:Lorg/microemu/RecordStoreManager;

    const/16 v1, 0x9

    invoke-virtual {p0}, Lorg/microemu/util/RecordStoreImpl;->getName()Ljava/lang/String;

    move-result-object v2

    invoke-interface {v0, v1, v2}, Lorg/microemu/RecordStoreManager;->fireRecordStoreListener(ILjava/lang/String;)V

    .line 142
    const/4 v0, 0x0

    iput-boolean v0, p0, Lorg/microemu/util/RecordStoreImpl;->open:Z

    .line 143
    return-void
.end method

.method public deleteRecord(I)V
    .locals 2
    .parameter "recordId"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljavax/microedition/rms/RecordStoreNotOpenException;,
            Ljavax/microedition/rms/InvalidRecordIDException;,
            Ljavax/microedition/rms/RecordStoreException;
        }
    .end annotation

    .prologue
    .line 288
    iget-boolean v0, p0, Lorg/microemu/util/RecordStoreImpl;->open:Z

    if-nez v0, :cond_0

    .line 289
    new-instance v0, Ljavax/microedition/rms/RecordStoreNotOpenException;

    invoke-direct {v0}, Ljavax/microedition/rms/RecordStoreNotOpenException;-><init>()V

    throw v0

    .line 292
    :cond_0
    monitor-enter p0

    .line 293
    :try_start_0
    iget-object v0, p0, Lorg/microemu/util/RecordStoreImpl;->records:Ljava/util/Hashtable;

    new-instance v1, Ljava/lang/Integer;

    invoke-direct {v1, p1}, Ljava/lang/Integer;-><init>(I)V

    invoke-virtual {v0, v1}, Ljava/util/Hashtable;->remove(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    if-nez v0, :cond_1

    .line 294
    new-instance v0, Ljavax/microedition/rms/InvalidRecordIDException;

    invoke-direct {v0}, Ljavax/microedition/rms/InvalidRecordIDException;-><init>()V

    throw v0

    .line 298
    :catchall_0
    move-exception v0

    monitor-exit p0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0

    .line 296
    :cond_1
    :try_start_1
    iget v0, p0, Lorg/microemu/util/RecordStoreImpl;->version:I

    add-int/lit8 v0, v0, 0x1

    iput v0, p0, Lorg/microemu/util/RecordStoreImpl;->version:I

    .line 297
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v0

    iput-wide v0, p0, Lorg/microemu/util/RecordStoreImpl;->lastModified:J

    .line 298
    monitor-exit p0
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    .line 300
    iget-object v0, p0, Lorg/microemu/util/RecordStoreImpl;->recordStoreManager:Lorg/microemu/RecordStoreManager;

    invoke-interface {v0, p0}, Lorg/microemu/RecordStoreManager;->saveChanges(Lorg/microemu/util/RecordStoreImpl;)V

    .line 302
    const/4 v0, 0x4

    invoke-direct {p0, v0, p1}, Lorg/microemu/util/RecordStoreImpl;->fireRecordListener(II)V

    .line 303
    return-void
.end method

.method public enumerateRecords(Ljavax/microedition/rms/RecordFilter;Ljavax/microedition/rms/RecordComparator;Z)Ljavax/microedition/rms/RecordEnumeration;
    .locals 1
    .parameter "filter"
    .parameter "comparator"
    .parameter "keepUpdated"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljavax/microedition/rms/RecordStoreNotOpenException;
        }
    .end annotation

    .prologue
    .line 388
    iget-boolean v0, p0, Lorg/microemu/util/RecordStoreImpl;->open:Z

    if-nez v0, :cond_0

    .line 389
    new-instance v0, Ljavax/microedition/rms/RecordStoreNotOpenException;

    invoke-direct {v0}, Ljavax/microedition/rms/RecordStoreNotOpenException;-><init>()V

    throw v0

    .line 392
    :cond_0
    new-instance v0, Lorg/microemu/util/RecordEnumerationImpl;

    invoke-direct {v0, p0, p1, p2, p3}, Lorg/microemu/util/RecordEnumerationImpl;-><init>(Lorg/microemu/util/RecordStoreImpl;Ljavax/microedition/rms/RecordFilter;Ljavax/microedition/rms/RecordComparator;Z)V

    return-object v0
.end method

.method public getHeaderSize()I
    .locals 1

    .prologue
    .line 399
    iget-object v0, p0, Lorg/microemu/util/RecordStoreImpl;->recordStoreName:Ljava/lang/String;

    invoke-virtual {v0}, Ljava/lang/String;->length()I

    move-result v0

    add-int/lit8 v0, v0, 0x4

    add-int/lit8 v0, v0, 0x8

    add-int/lit8 v0, v0, 0x4

    return v0
.end method

.method public getLastModified()J
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljavax/microedition/rms/RecordStoreNotOpenException;
        }
    .end annotation

    .prologue
    .line 213
    iget-boolean v0, p0, Lorg/microemu/util/RecordStoreImpl;->open:Z

    if-nez v0, :cond_0

    .line 214
    new-instance v0, Ljavax/microedition/rms/RecordStoreNotOpenException;

    invoke-direct {v0}, Ljavax/microedition/rms/RecordStoreNotOpenException;-><init>()V

    throw v0

    .line 217
    :cond_0
    monitor-enter p0

    .line 218
    :try_start_0
    iget-wide v0, p0, Lorg/microemu/util/RecordStoreImpl;->lastModified:J

    monitor-exit p0

    return-wide v0

    .line 219
    :catchall_0
    move-exception v0

    monitor-exit p0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method

.method public getName()Ljava/lang/String;
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljavax/microedition/rms/RecordStoreNotOpenException;
        }
    .end annotation

    .prologue
    .line 149
    iget-boolean v0, p0, Lorg/microemu/util/RecordStoreImpl;->open:Z

    if-nez v0, :cond_0

    .line 150
    new-instance v0, Ljavax/microedition/rms/RecordStoreNotOpenException;

    invoke-direct {v0}, Ljavax/microedition/rms/RecordStoreNotOpenException;-><init>()V

    throw v0

    .line 153
    :cond_0
    iget-object v0, p0, Lorg/microemu/util/RecordStoreImpl;->recordStoreName:Ljava/lang/String;

    return-object v0
.end method

.method public getNextRecordID()I
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljavax/microedition/rms/RecordStoreNotOpenException;,
            Ljavax/microedition/rms/RecordStoreException;
        }
    .end annotation

    .prologue
    .line 240
    iget-boolean v0, p0, Lorg/microemu/util/RecordStoreImpl;->open:Z

    if-nez v0, :cond_0

    .line 241
    new-instance v0, Ljavax/microedition/rms/RecordStoreNotOpenException;

    invoke-direct {v0}, Ljavax/microedition/rms/RecordStoreNotOpenException;-><init>()V

    throw v0

    .line 244
    :cond_0
    monitor-enter p0

    .line 245
    :try_start_0
    iget v0, p0, Lorg/microemu/util/RecordStoreImpl;->nextRecordID:I

    monitor-exit p0

    return v0

    .line 246
    :catchall_0
    move-exception v0

    monitor-exit p0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method

.method public getNumRecords()I
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljavax/microedition/rms/RecordStoreNotOpenException;
        }
    .end annotation

    .prologue
    .line 173
    iget-boolean v0, p0, Lorg/microemu/util/RecordStoreImpl;->open:Z

    if-nez v0, :cond_0

    .line 174
    new-instance v0, Ljavax/microedition/rms/RecordStoreNotOpenException;

    invoke-direct {v0}, Ljavax/microedition/rms/RecordStoreNotOpenException;-><init>()V

    throw v0

    .line 177
    :cond_0
    monitor-enter p0

    .line 178
    :try_start_0
    iget-object v0, p0, Lorg/microemu/util/RecordStoreImpl;->records:Ljava/util/Hashtable;

    invoke-virtual {v0}, Ljava/util/Hashtable;->size()I

    move-result v0

    monitor-exit p0

    return v0

    .line 179
    :catchall_0
    move-exception v0

    monitor-exit p0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method

.method public getRecord(I[BI)I
    .locals 3
    .parameter "recordId"
    .parameter "buffer"
    .parameter "offset"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljavax/microedition/rms/RecordStoreNotOpenException;,
            Ljavax/microedition/rms/InvalidRecordIDException;,
            Ljavax/microedition/rms/RecordStoreException;
        }
    .end annotation

    .prologue
    .line 328
    monitor-enter p0

    .line 329
    :try_start_0
    invoke-virtual {p0, p1}, Lorg/microemu/util/RecordStoreImpl;->getRecordSize(I)I

    move-result v0

    .line 330
    .local v0, recordSize:I
    iget-object v1, p0, Lorg/microemu/util/RecordStoreImpl;->records:Ljava/util/Hashtable;

    new-instance v2, Ljava/lang/Integer;

    invoke-direct {v2, p1}, Ljava/lang/Integer;-><init>(I)V

    invoke-virtual {v1, v2}, Ljava/util/Hashtable;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v1

    const/4 v2, 0x0

    invoke-static {v1, v2, p2, p3, v0}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V

    .line 332
    monitor-exit p0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 334
    const/4 v1, 0x2

    invoke-direct {p0, v1, p1}, Lorg/microemu/util/RecordStoreImpl;->fireRecordListener(II)V

    .line 336
    return v0

    .line 332
    .end local v0           #recordSize:I
    :catchall_0
    move-exception v1

    :try_start_1
    monitor-exit p0
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    throw v1
.end method

.method public getRecord(I)[B
    .locals 3
    .parameter "recordId"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljavax/microedition/rms/RecordStoreNotOpenException;,
            Ljavax/microedition/rms/InvalidRecordIDException;,
            Ljavax/microedition/rms/RecordStoreException;
        }
    .end annotation

    .prologue
    .line 345
    monitor-enter p0

    .line 346
    :try_start_0
    invoke-virtual {p0, p1}, Lorg/microemu/util/RecordStoreImpl;->getRecordSize(I)I

    move-result v1

    new-array v0, v1, [B

    .line 347
    .local v0, data:[B
    const/4 v1, 0x0

    invoke-virtual {p0, p1, v0, v1}, Lorg/microemu/util/RecordStoreImpl;->getRecord(I[BI)I

    .line 348
    monitor-exit p0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 350
    array-length v1, v0

    const/4 v2, 0x1

    if-ge v1, v2, :cond_0

    const/4 v1, 0x0

    :goto_0
    return-object v1

    .line 348
    .end local v0           #data:[B
    :catchall_0
    move-exception v1

    :try_start_1
    monitor-exit p0
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    throw v1

    .restart local v0       #data:[B
    :cond_0
    move-object v1, v0

    .line 350
    goto :goto_0
.end method

.method public getRecordHeaderSize()I
    .locals 1

    .prologue
    .line 405
    const/16 v0, 0x8

    return v0
.end method

.method public getRecordSize(I)I
    .locals 4
    .parameter "recordId"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljavax/microedition/rms/RecordStoreNotOpenException;,
            Ljavax/microedition/rms/InvalidRecordIDException;,
            Ljavax/microedition/rms/RecordStoreException;
        }
    .end annotation

    .prologue
    .line 309
    iget-boolean v2, p0, Lorg/microemu/util/RecordStoreImpl;->open:Z

    if-nez v2, :cond_0

    .line 310
    new-instance v2, Ljavax/microedition/rms/RecordStoreNotOpenException;

    invoke-direct {v2}, Ljavax/microedition/rms/RecordStoreNotOpenException;-><init>()V

    throw v2

    .line 313
    :cond_0
    monitor-enter p0

    .line 314
    :try_start_0
    iget-object v2, p0, Lorg/microemu/util/RecordStoreImpl;->records:Ljava/util/Hashtable;

    new-instance v3, Ljava/lang/Integer;

    invoke-direct {v3, p1}, Ljava/lang/Integer;-><init>(I)V

    invoke-virtual {v2, v3}, Ljava/util/Hashtable;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, [B

    move-object v0, v2

    check-cast v0, [B

    move-object v1, v0

    .line 315
    .local v1, data:[B
    if-nez v1, :cond_1

    .line 316
    new-instance v2, Ljavax/microedition/rms/InvalidRecordIDException;

    invoke-direct {v2}, Ljavax/microedition/rms/InvalidRecordIDException;-><init>()V

    throw v2

    .line 320
    .end local v1           #data:[B
    :catchall_0
    move-exception v2

    monitor-exit p0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v2

    .line 319
    .restart local v1       #data:[B
    :cond_1
    :try_start_1
    array-length v2, v1

    monitor-exit p0
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    return v2
.end method

.method public getSize()I
    .locals 4
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljavax/microedition/rms/RecordStoreNotOpenException;
        }
    .end annotation

    .prologue
    .line 186
    iget-boolean v2, p0, Lorg/microemu/util/RecordStoreImpl;->open:Z

    if-nez v2, :cond_0

    .line 187
    new-instance v2, Ljavax/microedition/rms/RecordStoreNotOpenException;

    invoke-direct {v2}, Ljavax/microedition/rms/RecordStoreNotOpenException;-><init>()V

    throw v2

    .line 190
    :cond_0
    const/4 v1, 0x0

    .line 191
    .local v1, size:I
    iget-object v2, p0, Lorg/microemu/util/RecordStoreImpl;->records:Ljava/util/Hashtable;

    invoke-virtual {v2}, Ljava/util/Hashtable;->keys()Ljava/util/Enumeration;

    move-result-object v0

    .local v0, keys:Ljava/util/Enumeration;
    :goto_0
    invoke-interface {v0}, Ljava/util/Enumeration;->hasMoreElements()Z

    move-result v2

    if-eqz v2, :cond_1

    .line 193
    iget-object v2, p0, Lorg/microemu/util/RecordStoreImpl;->records:Ljava/util/Hashtable;

    invoke-interface {v0}, Ljava/util/Enumeration;->nextElement()Ljava/lang/Object;

    move-result-object v3

    invoke-virtual {v2, v3}, Ljava/util/Hashtable;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, [B

    check-cast v2, [B

    array-length v2, v2

    add-int/2addr v1, v2

    goto :goto_0

    .line 195
    :cond_1
    return v1
.end method

.method public getSizeAvailable()I
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljavax/microedition/rms/RecordStoreNotOpenException;
        }
    .end annotation

    .prologue
    .line 202
    iget-boolean v0, p0, Lorg/microemu/util/RecordStoreImpl;->open:Z

    if-nez v0, :cond_0

    .line 203
    new-instance v0, Ljavax/microedition/rms/RecordStoreNotOpenException;

    invoke-direct {v0}, Ljavax/microedition/rms/RecordStoreNotOpenException;-><init>()V

    throw v0

    .line 206
    :cond_0
    iget-object v0, p0, Lorg/microemu/util/RecordStoreImpl;->recordStoreManager:Lorg/microemu/RecordStoreManager;

    invoke-interface {v0, p0}, Lorg/microemu/RecordStoreManager;->getSizeAvailable(Lorg/microemu/util/RecordStoreImpl;)I

    move-result v0

    return v0
.end method

.method public getVersion()I
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljavax/microedition/rms/RecordStoreNotOpenException;
        }
    .end annotation

    .prologue
    .line 160
    iget-boolean v0, p0, Lorg/microemu/util/RecordStoreImpl;->open:Z

    if-nez v0, :cond_0

    .line 161
    new-instance v0, Ljavax/microedition/rms/RecordStoreNotOpenException;

    invoke-direct {v0}, Ljavax/microedition/rms/RecordStoreNotOpenException;-><init>()V

    throw v0

    .line 164
    :cond_0
    monitor-enter p0

    .line 165
    :try_start_0
    iget v0, p0, Lorg/microemu/util/RecordStoreImpl;->version:I

    monitor-exit p0

    return v0

    .line 166
    :catchall_0
    move-exception v0

    monitor-exit p0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method

.method public isOpen()Z
    .locals 1

    .prologue
    .line 120
    iget-boolean v0, p0, Lorg/microemu/util/RecordStoreImpl;->open:Z

    return v0
.end method

.method public removeRecordListener(Ljavax/microedition/rms/RecordListener;)V
    .locals 1
    .parameter "listener"

    .prologue
    .line 233
    iget-object v0, p0, Lorg/microemu/util/RecordStoreImpl;->recordListeners:Ljava/util/Vector;

    invoke-virtual {v0, p1}, Ljava/util/Vector;->removeElement(Ljava/lang/Object;)Z

    .line 234
    return-void
.end method

.method public setOpen(Z)V
    .locals 0
    .parameter "open"

    .prologue
    .line 126
    iput-boolean p1, p0, Lorg/microemu/util/RecordStoreImpl;->open:Z

    .line 127
    return-void
.end method

.method public setRecord(I[BII)V
    .locals 4
    .parameter "recordId"
    .parameter "newData"
    .parameter "offset"
    .parameter "numBytes"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljavax/microedition/rms/RecordStoreNotOpenException;,
            Ljavax/microedition/rms/InvalidRecordIDException;,
            Ljavax/microedition/rms/RecordStoreException;,
            Ljavax/microedition/rms/RecordStoreFullException;
        }
    .end annotation

    .prologue
    .line 357
    iget-boolean v2, p0, Lorg/microemu/util/RecordStoreImpl;->open:Z

    if-nez v2, :cond_0

    .line 358
    new-instance v2, Ljavax/microedition/rms/RecordStoreNotOpenException;

    invoke-direct {v2}, Ljavax/microedition/rms/RecordStoreNotOpenException;-><init>()V

    throw v2

    .line 362
    :cond_0
    iget-object v2, p0, Lorg/microemu/util/RecordStoreImpl;->recordStoreManager:Lorg/microemu/RecordStoreManager;

    invoke-interface {v2, p0}, Lorg/microemu/RecordStoreManager;->getSizeAvailable(Lorg/microemu/util/RecordStoreImpl;)I

    move-result v2

    if-le p4, v2, :cond_1

    .line 363
    new-instance v2, Ljavax/microedition/rms/RecordStoreFullException;

    invoke-direct {v2}, Ljavax/microedition/rms/RecordStoreFullException;-><init>()V

    throw v2

    .line 366
    :cond_1
    new-array v1, p4, [B

    .line 367
    .local v1, recordData:[B
    const/4 v2, 0x0

    invoke-static {p2, p3, v1, v2, p4}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V

    .line 369
    monitor-enter p0

    .line 370
    :try_start_0
    new-instance v0, Ljava/lang/Integer;

    invoke-direct {v0, p1}, Ljava/lang/Integer;-><init>(I)V

    .line 371
    .local v0, id:Ljava/lang/Integer;
    iget-object v2, p0, Lorg/microemu/util/RecordStoreImpl;->records:Ljava/util/Hashtable;

    invoke-virtual {v2, v0}, Ljava/util/Hashtable;->remove(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v2

    if-nez v2, :cond_2

    .line 372
    new-instance v2, Ljavax/microedition/rms/InvalidRecordIDException;

    invoke-direct {v2}, Ljavax/microedition/rms/InvalidRecordIDException;-><init>()V

    throw v2

    .line 377
    .end local v0           #id:Ljava/lang/Integer;
    :catchall_0
    move-exception v2

    monitor-exit p0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v2

    .line 374
    .restart local v0       #id:Ljava/lang/Integer;
    :cond_2
    :try_start_1
    iget-object v2, p0, Lorg/microemu/util/RecordStoreImpl;->records:Ljava/util/Hashtable;

    invoke-virtual {v2, v0, v1}, Ljava/util/Hashtable;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 375
    iget v2, p0, Lorg/microemu/util/RecordStoreImpl;->version:I

    add-int/lit8 v2, v2, 0x1

    iput v2, p0, Lorg/microemu/util/RecordStoreImpl;->version:I

    .line 376
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v2

    iput-wide v2, p0, Lorg/microemu/util/RecordStoreImpl;->lastModified:J

    .line 377
    monitor-exit p0
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    .line 379
    iget-object v2, p0, Lorg/microemu/util/RecordStoreImpl;->recordStoreManager:Lorg/microemu/RecordStoreManager;

    invoke-interface {v2, p0}, Lorg/microemu/RecordStoreManager;->saveChanges(Lorg/microemu/util/RecordStoreImpl;)V

    .line 381
    const/4 v2, 0x3

    invoke-direct {p0, v2, p1}, Lorg/microemu/util/RecordStoreImpl;->fireRecordListener(II)V

    .line 382
    return-void
.end method

.method public write(Ljava/io/DataOutputStream;)V
    .locals 6
    .parameter "dos"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 102
    iget-object v4, p0, Lorg/microemu/util/RecordStoreImpl;->recordStoreName:Ljava/lang/String;

    invoke-virtual {p1, v4}, Ljava/io/DataOutputStream;->writeUTF(Ljava/lang/String;)V

    .line 103
    iget v4, p0, Lorg/microemu/util/RecordStoreImpl;->version:I

    invoke-virtual {p1, v4}, Ljava/io/DataOutputStream;->writeInt(I)V

    .line 104
    iget-wide v4, p0, Lorg/microemu/util/RecordStoreImpl;->lastModified:J

    invoke-virtual {p1, v4, v5}, Ljava/io/DataOutputStream;->writeLong(J)V

    .line 105
    iget v4, p0, Lorg/microemu/util/RecordStoreImpl;->nextRecordID:I

    invoke-virtual {p1, v4}, Ljava/io/DataOutputStream;->writeInt(I)V

    .line 107
    iget-object v4, p0, Lorg/microemu/util/RecordStoreImpl;->records:Ljava/util/Hashtable;

    invoke-virtual {v4}, Ljava/util/Hashtable;->keys()Ljava/util/Enumeration;

    move-result-object v2

    .line 108
    .local v2, en:Ljava/util/Enumeration;
    :goto_0
    invoke-interface {v2}, Ljava/util/Enumeration;->hasMoreElements()Z

    move-result v4

    if-eqz v4, :cond_0

    .line 109
    invoke-interface {v2}, Ljava/util/Enumeration;->nextElement()Ljava/lang/Object;

    move-result-object v3

    check-cast v3, Ljava/lang/Integer;

    .line 110
    .local v3, key:Ljava/lang/Integer;
    invoke-virtual {v3}, Ljava/lang/Integer;->intValue()I

    move-result v4

    invoke-virtual {p1, v4}, Ljava/io/DataOutputStream;->writeInt(I)V

    .line 111
    iget-object v4, p0, Lorg/microemu/util/RecordStoreImpl;->records:Ljava/util/Hashtable;

    invoke-virtual {v4, v3}, Ljava/util/Hashtable;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v4

    check-cast v4, [B

    move-object v0, v4

    check-cast v0, [B

    move-object v1, v0

    .line 112
    .local v1, data:[B
    array-length v4, v1

    invoke-virtual {p1, v4}, Ljava/io/DataOutputStream;->writeInt(I)V

    .line 113
    invoke-virtual {p1, v1}, Ljava/io/DataOutputStream;->write([B)V

    goto :goto_0

    .line 115
    .end local v3           #key:Ljava/lang/Integer;
    .end local v1           #data:[B
    :cond_0
    return-void
.end method
